<template>
  <p>AsyncComponent</p>
  <p>
    {{data}}
  </p>
 </template>
 <script>
 function fetchDataFromAPI(){
  return new Promise((resolve)=>{
    setTimeout(() => {
        resolve('fetched Data From API');
    }, 2000);
  });
 }
 export default {
  //setup函数返回了一个Promise
  //就需要把组件放在<Suspense> 的子组件树中
  async setup(){
    const data = await fetchDataFromAPI();
    return {
      data
    }
  }
 }
 </script>